package com.dao;

import com.pojo.Building;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BuildingDao {

    List<Building> findAllBuild();


    /**
     * 根据楼名查询楼id
     * @param bname
     * @return
     */
    Integer FindBuildIdByName(@Param("bname") String bname);



    /**
     * 根据id添加对应的楼与管理员
     * @param id
     * @param adminid
     * @return
     */
    Integer addBuildAdmin(@Param("bid")String id, @Param("adminid") String adminid);



    /**
     * 添加楼与宿管对应表表
     * @param bid
     * @param eid
     * @return
     */
    Integer updateBuildEmp(@Param("bid")String bid, @Param("eid") String eid);


    /**
     * 根据id删除对应的楼与管理员
     * @param id
     * @return
     */
    Integer DeleteBuildEmp(@Param("id") String id);




    @Insert("insert into building(name) values(#{name})")
    Integer insert(@Param("name") String name);


    @Delete("delete from building where id = #{id}")
    Integer delete(@Param("id") String id);

    @Update("update building set name = #{name} where id = #{id}")
    Integer updateById(Building building);


    @Select("select * from building where name = #{name}")
    Building selectByName(String name);

    @Select("select name from building where id = #{id}")
    String selectById(String id);


}
